<template>
	<view class="content">
		<image class="logo" v-if="loginQrCode" :src="loginQrCode"></image>
		<view class="text-area">
			<text class="title" @tap="login()">{{title}}</text>
		</view>
	</view>
</template>

<script>
	import ruov from '@/ruov/index.js'
	export default {
		data() {
			return {
				loginQrCode: '',
				title: "公众号登录测试"
			}
		},
		onLoad() {

		},
		methods: {
			login() {
				let that = this
				ruov.offiaccount.login((data) => {
					that.loginQrCode = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + data.data.ticket
				}).then(res => {
					that.loginQrCode = ""
					that.title = `欢迎您:${res.data}!`
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
